package com.axcbd.demo.controller;

import com.axcbd.demo.service.HlsVideoBackupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;

@RestController
public class HlsVideoBackupController {

    @Autowired
    private HlsVideoBackupService hlsVideoBackupService;

    // 启动备份任务的接口
    @GetMapping("/start-hls-backup")
    public String startHlsBackup() {
        hlsVideoBackupService.startBackup();
        return "HLS备份任务已启动";
    }

    // 停止备份任务的接口
    @GetMapping("/stop-hls-backup")
    public String stopHlsBackup() {
        hlsVideoBackupService.stopBackup();
        return "HLS备份任务已停止";
    }

    // 获取备份任务状态的接口
    @GetMapping("/hls-backup-status")
    public Map<String, String> getHlsBackupStatus() {
        return hlsVideoBackupService.getBackupTasks();
    }
}